var wzid=null;
var mbid=null;
$(function(){

    $("body").layout({
        spacing_open:0,
        spacing_closed:0,
        closable:false,
        resizable:false
    });

    $("#list-group").on("click","li",function(){
        $("#list-group .active").removeClass("active");
        $(this).addClass("active");
        var id = $(this).attr("id");
        $("#scj_id").val(id);
    });

    mbid=getUrlString("mbid");
    wzid=getUrlString("wzid");

 });

/****/
function bcSc(){

    var tbyy_id = $("#list-group>.list-group-item.active").attr("id");
    var url = $("#list-group>.list-group-item.active").attr("data");
    var tbyy_mc = $("#list-group>.list-group-item.active").text();

    $.ajax({
        url: "/portal/user/layout/saveMbWz.do",
        type: "post",
        data:{
            "tbyy_id":tbyy_id,
            "wzid":wzid,
            "mbid":mbid
        },
        dataType:"json",
        async:false,
        timeout:sys_timeout,
        error:function(XMLHttpRequest, textStatus){

        },
        success:function(responseText){

            if(responseText.code==0){
                parent.$("#collectModal").modal("hide");
                parent.upWzMb(tbyy_id,wzid,mbid,tbyy_mc,url);
            }
        }
    });

}


function getUrlString(name) {

    var reg = new RegExp("(^|&)" + name + "=([^&*])(&|$)", "ig");

    var url = window.location.href;

    if (url.indexOf("?") > -1) {
        url = url.substring(url.indexOf("?") + 1, url.length);
        var arr = url.split("&");
        for (var i = 0; i < arr.length; i++) {
            if (name == arr[i].split("=")[0]) {
               return arr[i].split("=")[1]
            }
        }
    }

    return null;

}